#pragma once

//#include "game_graphics.h"
#include "global_config.h"
#include <string>
#include <stdio.h>

struct MessageRouter;
struct Chunk;

//every x frames the entity updates

//GameInput
enum game_key_flag
{
	KEY_UP,
	KEY_DOWN,
	KEY_LEFT,
	KEY_RIGHT,
	KEY_EXIT,
	KEY_ENTER,
	KEY_SPACE,
	KEY_MOUSE_LEFT,
	KEY_MOUSE_RIGHT,
	KEY_MOUSE_MIDDLE,
};

LOCAL_CONSTANT int GAME_KEY_FLAG_COUNT = (10);

//convert this to bitflags (when thinking about multiplayer networking)
struct GameInput
{
	bool quit;
	bool down[GAME_KEY_FLAG_COUNT];
	bool pressed[GAME_KEY_FLAG_COUNT];
	bool released[GAME_KEY_FLAG_COUNT];

	GameInput()
	{
		quit = 0;
		for (int i = 0; i < GAME_KEY_FLAG_COUNT; i++)
		{
			down[i] = 0;
			pressed[i] = 0;
			released[i] = 0;
		}
	}
};




struct TickInfo
{
	TIME_MS_int last_frame_tick;
	TIME_MS_int _ticksSinceLastFrame;
};

struct Game
{
	POS_ABS_V2 camera_pos;
	Chunk * _chunks[G::CHUNK_COUNT][G::CHUNK_COUNT];
	MessageRouter * _message_router;
	SDL_Event sdl_event;

	TickInfo tick_info;

	Game();
	Game (const Game & other){printf("Game copied!");}
};

Game * game_get();

//returns the screen position of the mouse pointer
V2i game_input_get_mouse_pos();

void game_setup(Game * game);
BOOL_QUIT game_run(Game * game);
